<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page  isELIgnored="false"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/bootstrap.min.css" />

    <link href="<%=request.getContextPath()%>/assets/css/font-awesome.css" rel="stylesheet" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <script src="assets/js/jquery-1.10.2.js"></script>
	<script  type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap.min.js" ></script>
	<link href="assets/css/bootstrap-fileupload.min.css" rel="stylesheet" />
	<link href="assets/css/custom.css" rel="stylesheet" />
	 <link href="assets/css/basic.css" rel="stylesheet" />
	 <link rel="stylesheet" href="css/Orderfont.css"><link>
	  </head>
  
  <body>
               <div class="panel panel-info">
                        <div class="page-header">
		  		<h1><small>添加机构<i class="icon-double-angle-right"></i></small></h1>
			</div>
                        <div class="panel-body">
                            <form method="post" role="form" action="institutionManagement/addInstitutionPost" class="form-horizontal" enctype="multipart/form-data">
                                        <%--机构名称 --%>
	                                     <div class="form-group">
	                                          <label for="name" class="control-label col-sm-3">机构名称</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="name" id="name"> 
	                                          </div>
	                                      </div>
                                 		
                                        <%-- 机构地址 --%>
	                                     <div class="form-group">
	                                          <label for="address" class="control-label col-sm-3"> 机构地址</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="address" id="address"> 
	                                          </div>
	                                      </div>                                        
                                           
                                        <%--联系电话 --%>
                                 		<div class="form-group">
	                                          <label for="phone" class="control-label col-sm-3">联系电话</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="phone" id="phone"> 
	                                          </div>
                                        </div>  
                                        <%--座机 --%>
                                 		<div class="form-group">
	                                          <label for="landline" class="control-label col-sm-3">座机</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="landline" id="landline"> 
	                                          </div>
                                        </div>   
                                        <%--传真 --%>
                                 		<div class="form-group">
	                                          <label for="fax" class="control-label col-sm-3">传真</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="fax" id="fax"> 
	                                          </div>
                                        </div>                                                                              
                                        <%--机构邮箱 --%>
                                 		<div class="form-group">
	                                          <label for="mail" class="control-label col-sm-3">机构邮箱</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="mail" id="mail"> 
	                                          </div>
                                        </div>
                                        <%--机构法人 --%>
                                 		<div class="form-group">
	                                          <label for="corporation" class="control-label col-sm-3">机构法人</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="corporation" id="corporation"> 
	                                          </div>
                                        </div> 
                                        <%--手术室数量 --%>
                                 		<div class="form-group">
	                                          <label for="corporation" class="control-label col-sm-3">手术室数量</label>
	                                          <div class="col-sm-6">
	                                          		<input class="form-control" type="text" name="roomNum" id="roomNum"> 
	                                          </div>
                                        </div>                                                                             
                                        <%--营业执照 照片 --%>                                      
					                    <div class="form-group">
					                        <label class="control-label col-sm-3">上传营业执照照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input name="certs" type="file" multiple="multiple" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>
					                    </div>  
                               
                                      
                                        <%--机构外观照片 --%>
                                 		<div class="form-group">
                                            <label for="degreeImg" class="control-label col-sm-3">机构外观照片</label>
					                        <div class="col-sm-3">
					                             <div class="fileupload fileupload-new" data-provides="fileupload"> 
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" multiple="multiple" name="appears" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>
                                        </div>
                                        <%--机构logo照片 1张 --%>                                  
						                     <div class="form-group">
						                        <label class="control-label col-sm-3">上传机构logo照片</label>
						                            <div class="fileupload fileupload-new" data-provides="fileupload" >
						                                <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;"><img src="assets/img/demoUpload.jpg" alt="" /></div> 
						                                <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
						                                
						                                    <span class="btn btn-file btn-success" style="margin:30px"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" name="portr" accept="image/*"></span>
						                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
						                            </div>
						                    </div>                                          
                                        <%--机构内部设备照片 --%>
                                 		<div class="form-group">
					                        <label class="control-label col-sm-3">机构内部设备照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                            <%--     <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>--%>
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" multiple="multiple" name="devs" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>	
                                        </div>   
                                        <button type="submit" class="btn btn-info" id="sm">提交</button>

                                    </form>
                            	</div>
                            </div>

<script src="assets/js/bootstrap-fileupload.js"></script>

<script type="text/javascript" >
$("#sm").click(function() {
	var name = $("#name").val();
	var phone = $("#phone").val();
	var addr = $("#address").val();
	var mail = $("#mail").val();
	var corporation = $("#corporation");
	
	var reg_phone = /(^[0-9]{3,4}-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}1[0-9]{10}$)/;
	var reg_mail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
	
	var portr = $("input[type=file][name=portr]");
	var devs = $("input[type=file][name=devs]");
	var certs = $("input[type=file][name=certs]");
	var appears = $("input[type=file][name=appears]");

	if(name == "") {
		alert("请输入机构名称");
		return false;	
	}	
	if(phone == ""||(!reg_phone.test(phone) )) {
		alert("未输入电话号码或输入格式不符合要求");
		return false;	
	}	
	if(addr == "") {
		alert("请输入机构地址")
		return false;	
	}	
	if(mail == ""||(!reg_mail.test(mail) )) {
		alert("未输入机构邮箱或输入格式不符合要求");
		return false;	
	}	
	if(corporation == "") {
		alert("请输入机构法人");
		return false;	
	}			
	if(portr.val() == "") {
		alert("请上传机构头像照片");
		return false;
	}
	if(devs.val() == "") {
		alert("请上传机构内部设备照片");
		return false;
	}
	if(appears.val() == "") {
		alert("请上传机构外观照片");
		return false;
	}
	if(certs.val() == "") {
		alert("请上传执业证照片");
		return false;
	}
	
});
</script>
  </body>
</html>